package com.vmj.instructions.base;

import com.vmj.common.BytesReader;
import com.vmj.rtda.Frame;

/**
 * Created by yangshoujun on 2017/8/18 下午11:21.
 */
public class BranchInstruction implements Instruction {

    private int offset;

    public static void branch(Frame frame, int offset) {
        int pc = frame.getThread().getPc();
        int nextPc = pc + offset;
        frame.setNextPc(nextPc);
    }

    public void fetchOperands(BytesReader reader) {
        offset = reader.readShort();
    }

    public void execute(Frame frame) {

    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }
}
